home *** CD-ROM | disk | FTP | other *** search
/ How Would You Survive? / How Would You Survive (1995)(Grolier)[Mac-PC].iso / mac / SHARED.DIR / 01992_Script_a9StateButton < prev    next >
Text File  |  1995-09-13  |  3KB  |  115 lines

  1. property pSprite,pCast,pNutral,pHilighted,pSelected,pFunction,pMySound,pCursor,¼
  2.          pbeenClicked,pRolloverFunction, pSkipReset
  3.  
  4. on birth me,theSprite,theCast,aSound,aFunction,aCursor,aRolloverFunction, aSkipReset
  5.   -- assumes that the sprite has the correct cast member in the correct loc
  6.   -- assumes that the normal and depressed art are in cast numbers theCast and theCast + 1
  7.   set pSprite = theSprite
  8.   set pcursor = aCursor
  9.   set pCast = theCast
  10.   set pMySound = aSound
  11.   set pNutral = pCast
  12.   set pSkipReset=aSkipReset
  13.   set pHilighted = pCast + 1
  14.   set pSelected = pCast + 2
  15.   set pFunction = aFunction
  16.   set pRolloverFunction = aRolloverFunction
  17.   --  puppetSprite pSprite,TRUE
  18.   --  set the castNum of sprite pSprite = pCast
  19.   return me
  20. end
  21.  
  22. on setNewFunction me, aFunction 
  23.   set pFunction = aFunction
  24. end
  25.  
  26. on setnewRolloverFunction me, aRolloverFunction 
  27.   --delux--why is this here?
  28.   set pRolloverFunction = aRolloverFunction
  29. end
  30.  
  31. on setNewSound me, aSound 
  32.   set pMySound = aSound
  33. end
  34.  
  35. on reset me
  36.   set the castNum of sprite pSprite = pNutral
  37.   updatestage
  38. end
  39.  
  40. on hilight me
  41.   set pbeenClicked to False
  42.   repeat while (rollover(pSprite))
  43.     do pCursor
  44.     puppettransition 0
  45.     if pRolloverFunction = "" then
  46.       nothing
  47.     else
  48.       do pRolloverFunction
  49.     end if
  50.     if (the castNum of sprite pSprite = pNutral) then
  51.       set the castNum of sprite pSprite = pHilighted 
  52.       if (pMySound) then puppetSound (cast pMySound)
  53.       set pbeenClicked to False
  54.       Updatestage
  55.     else
  56.       if (the mouseDown) then
  57.         set the castNum of sprite pSprite = pSelected
  58.         set pbeenClicked to TRUE
  59.         Updatestage
  60.       else 
  61.         -- the mouse is up
  62.         if (pbeenClicked = true and rollover(pSprite)) then
  63.           if not(pSkipReset) then reset
  64.           Updatestage
  65.           do pFunction
  66.           return TRUE
  67.           abort
  68.         end if
  69.       end if
  70.     end if
  71.   end repeat
  72.   reset
  73.   return FALSE
  74. end
  75.  
  76. on toggle me
  77.   set the castNum of sprite pSprite = pSelected
  78.   upDateStage
  79.   repeat while (the mouseDown)
  80.     if rollover(pSprite) then
  81.       set the castNum of sprite pSprite = pSelected
  82.       set pbeenClicked to true
  83.     else
  84.       set the castNum of sprite pSprite = pNutral
  85.       set pbeenClicked to false
  86.     end if
  87.     updatestage
  88.   end repeat
  89. end
  90.  
  91. on hideControl me
  92.   puppetSprite pSprite, FALSE
  93. end
  94.  
  95. on showControl me
  96.   puppetSprite pSprite,TRUE
  97. end 
  98.  
  99. on changeBaseButton me, newBase
  100.   set pCast = newBase
  101.   set the castNum of sprite pSprite = pCast
  102.   showControl(me)
  103. end
  104.  
  105. on setDemoHilight me 
  106.   set the castNum of sprite pSprite = pHilighted
  107.   upDateStage
  108. end
  109.  
  110. on mCastExists me, pName
  111.   return (the name of cast pCast starts pName)
  112. end mCastExists
  113.  
  114.  
  115.